<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<!DOCTYPE html>
<html lang="zh-CN" >
<head>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>新增报价方案</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<body class="iframeBody">
<div class="Wrapper">
	<div id="pageInTab" class="pageInTab">
			<div tabid="tabA" title="基本信息" lselected="true">
	            <form id="formSet1">
	                <div class="fieldset1 tabel_col clearFix">
	                	<div class="caption">
	                        <span class="title">基本信息</span>
	                    </div>
	                    <div class="fieldBox col_33">
		                    <div class="label">方案名称</div>
		                    <div class="field">
		                        <input name="prpsCfgNm" id="prpsCfgNm" type="text" class="ui-textbox" validate="{required:true}">
		                        <span class="requiredSymbol">*</span>
		                    </div>
		                </div>
	                    <div class="fieldBox col_33">
		                    <div class="label">方案政策标准</div>
		                    <div class="field">
		                        <select name="prpsTypCd" id="prpsTypCd" data-value=" ">
		                        	<option value=" " checked >请选择</option>
									<c:forEach items="${prpsTypCdList }" var="kv">
									    <option value="${kv.key }">${kv.value }</option>
									</c:forEach>
								</select>
		                    </div>
		                </div>
		                <div class="fieldBox col_33">
		                    <div class="label">方案配置编号</div>
		                    <div class="field">
		                        <input name="prpsCfgNo" id="prpsCfgNo" type="text" class="ui-textbox">
		                    </div>
		                </div>
		                <div class="fieldBox col_33">
		                    <div class="label">方案产品类型</div>
		                    <div class="field">
		                        <select name="prpsPrdTypCd" id="prpsPrdTypCd" data-value=" ">
		                        	<option value=" " checked >请选择</option>
									<c:forEach items="${prpsPrdTypCdList }" var="kv">
									    <option value="${kv.key }">${kv.value }</option>
									</c:forEach>
								</select>
		                    </div>
		                </div>
		                <div class="fieldBox col_33">
		                    <div class="label">租赁系数</div>
		                    <div class="field">
		                        <input name="lsCoe" id="lsCoe" type="text" class="ui-textbox" validate="{number:true}">
		                    </div>
		                </div>
		                <div class="fieldBox col_33">
		                    <div class="label">有效日期(起)</div>
		                    <div class="field">
		                    	<input name="expStDt" id="expStDt" type="text" class="ui-datepicker" value="" validate="{required:true}">
		                        <span class="requiredSymbol">*</span>
		                    </div>
		                </div>
		                <div class="fieldBox col_33">
		                    <div class="label">有效日期(止)</div>
		                    <div class="field">
		                        <input name="expEndDt" id="expEndDt" type="text" class="ui-datepicker" value="" validate="{required:true}">
		                        <span class="requiredSymbol">*</span>
		                    </div>
		                </div>
		                <div class="fieldBox col_33">
		                    <div class="label">是否允许添加费用项</div>
		                    <div class="field">
		                        <select name="isAllowAdd" id="isAllowAdd" data-value=" " validate="{required:true,select:true}">
		                        	<option value=" " checked >请选择</option>
									<c:forEach items="${yesOrNoCdList }" var="kv">
									    <option value="${kv.key }">${kv.value }</option>
									</c:forEach>
								</select>
								<span class="requiredSymbol">*</span>
		                    </div>
		                </div>
		                <div class="fieldBox col_33">
		                    <div class="label">是否系统内置</div>
		                    <div class="field">
		                        <select name="isSysDef" id="isSysDef" data-value=" " validate="{required:true,select:true}">
		                        	<option value=" " checked >请选择</option>
									<c:forEach items="${yesOrNoCdList }" var="kv">
									    <option value="${kv.key }">${kv.value }</option>
									</c:forEach>
								</select>
								<span class="requiredSymbol">*</span>
		                    </div>
		                </div>
		                <div class="fieldBox col_33">
		                    <div class="label">支付方式</div>
		                    <div class="field">
		                        <select name="payWayCd" id="payWayCd" data-value=" ">
		                        	<option value=" " checked >请选择</option>
									<c:forEach items="${payWayCdList }" var="kv">
									    <option value="${kv.key }">${kv.value }</option>
									</c:forEach>
								</select>
								<input type="checkbox" id="payWayCd_flag" name="payWayCd_flag"/>
		                    </div>
		                </div>
		                <div class="fieldBox col_33">
		                    <div class="label">客户保证金处理方式</div>
		                    <div class="field">
		                        <select name="dpstHdlWayCd" id="dpstHdlWayCd" data-value=" ">
		                        	<option value=" " checked >请选择</option>
									<c:forEach items="${dpstHdlWayCdList }" var="kv">
									    <option value="${kv.key }">${kv.value }</option>
									</c:forEach>
								</select>
								<input type="checkbox" id="dpstHdlWayCd_flag" name="dpstHdlWayCd_flag"/>
		                    </div>
		                </div>
		                <div class="fieldBox col_33">
		                    <div class="label">租赁期数</div>
		                    <div class="field">
		                        <input name="lsPd" id="lsPd" type="text" class="ui-textbox" ligerui="width: 110,digits: true" value="" validate="{number:true}">
		                        <select name="lsPdUntCd" id="lsPdUntCd" ligerui="width: 60" data-value="">
									<c:forEach items="${lsPdUntCdList }" var="kv" begin="0" step="1" varStatus="status">
										<c:if test="${status.index == 0}">
									    	<option value="${kv.key }" checked >${kv.value }</option>
										</c:if>
									    <c:if test="${status.index != 0}">
									    	<option value="${kv.key }">${kv.value }</option>
									 	</c:if>
									</c:forEach>
								</select>
								<input type="checkbox" id="lsPdUntCd_flag" name="lsPdUntCd_flag"/>
		                    </div>
		                </div>
		                <div class="fieldBox col_33">
		                    <div class="label">租赁期满处理方式</div>
		                    <div class="field">
		                        <select name="expHdlWayCd" id="expHdlWayCd" data-value=" ">
		                        	<option value=" " checked >请选择</option>
									<c:forEach items="${expHdlWayCdList }" var="kv">
									    <option value="${kv.key }">${kv.value }</option>
									</c:forEach>
								</select>
								<input type="checkbox" id="expHdlWayCd_flag" name="expHdlWayCd_flag"/>
		                    </div>
		                </div>
		                <div class="fieldBox col_33">
		                    <div class="label">年利率</div>
		                    <div class="field">
								&nbsp;&nbsp;<input type="checkbox" id="ai_flag" name="ai_flag"/>
		                    </div>
		                </div>
		                <div class="fieldBox col_33" style="display: none">
		                    <div class="label">供应商返利政策</div>
		                    <div class="field">
		                        <select name="splRebPolicy" id="splRebPolicy" data-value=" ">
		                        	<option value=" " checked >请选择</option>
									<c:forEach items="${splRebPolicyList }" var="kv">
									    <option value="${kv.key }">${kv.value }</option>
									</c:forEach>
								</select>
		                    </div>
		                </div>
		                <div class="fieldBox col_100">
							<div class="label">注意:</div>
							<div class="field">
								<span name="" id="" style="color: red;">方案中不允许修改的选项在后边打上勾即可,不勾默认引用此方案时此项可以修改.</span>
							</div>
						</div>
						<div class="fieldBox col_33">
		                    <div class="label">比例精度(小数位)</div>
		                    <div class="field">
		                        <select name="buOrgCd" id="buOrgCd" data-value=" " validate="" onchange="getDemicMap();">
		                        	<option value=" " checked >请选择</option>
									<c:forEach items="${buOrgCdList }" var="kv">
									    <option value="${kv.key }">${kv.value }</option>
									</c:forEach>
								</select>
		                    </div>
		                </div>
		                <div class="caption">
				            <span class="title">详细信息</span>
				        </div>
				        <div class="fieldBox col_100">
				            <div class="sqPanel">
				                <div class="sqPanel_head inL">
				                    <div class="btnsBox inLC">
				                        <span id="addBtn" class="sq-button sq-button-round">添加</span>
				                        <span id="delBtn" class="sq-button sq-button-round">删除</span>
				                    </div>
				                    <span>相关费用</span>
				                </div>
				                <div class="sqPanel_body">
				                    <div id="ligergrid_fee" class="sq-grid"></div>
				                </div>
				            </div>
				        </div>
	                </div>
	                <div class="fieldset1 clearFix">
		                <div class="btnsBox">
			                <span id="saveBtn1" class="sq-button sq-button-round">保存</span>
			                <input name=prpsCfgId id="prpsCfgId" type="hidden" value="${id }">
			            </div>
	                </div>
	            </form>
		</div>
		<div tabid="tabB" title="配置属性">
            <iframe frameborder="0" name="tabB" id="tabB" src=""></iframe>
        </div>
		<div tabid="tabC" title="年利率配置">
            <iframe frameborder="0" name="tabC" id="tabC" src=""></iframe>
        </div>
		<div tabid="tabD" title="融资返利比例配置">
            <iframe frameborder="0" name="tabD" id="tabD" src=""></iframe>
        </div>
		<div tabid="tabE" title="手续费比例配置">
            <iframe frameborder="0" name="tabE" id="tabE" src=""></iframe>
        </div>
	</div>
</div>

<script type="text/javascript">
var feeGrid;//相关费用信息
var loadedTabs=[];
var gpsRebBscPct = "";
var gpsRebBscPc = "";
var lsRebBscPct = "";

$(function(){
	$('#formSet1').ligerForm({
        validate : true
	});
	//liger.get("isSysDef").setDisabled(true);

	//当前登录人所属事业部
	var _currentBuOrgCd = '${currentBuOrgCd}';
	if(_currentBuOrgCd){
		var buOrgCdObj = liger.get("buOrgCd");
		buOrgCdObj.selectValue(_currentBuOrgCd);
		buOrgCdObj.setDisabled();
	}
	$("#saveBtn1").click(function(event) {
	    var form = liger.get("formSet1");
	    if (!form.valid()) {
	    	$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO , SQ_type: "warning" });
            return false; //验证不通过，不执行以下代码
        }
	    var data = form.getData();
	  	data["expStDt"] = $("#expStDt").val();
        data["expEndDt"] = $("#expEndDt").val();
        data["feeInfo"] = JSON.stringify(feeGrid.getData());
        
	    var id = $("#prpsCfgId").val();
        var url = '<%=path%>/project/prjQuatPrpsCfgM/add.do';
        if(id != ""){
        	url = '<%=path%>/project/prjQuatPrpsCfgM/modify.do';
        	data["id"]= id;
        }
        var wait_dialog;
	    $.ajax({
			type: 'post',
			dataType:'json',
			data:data,
			url: url,
			beforeSend: function(){
		          wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
		     },
			success:function(msg){
				 wait_dialog.close();
				 if(msg.success == 1){
					 $.ligerDialog.SQalert({content:msg.info, SQ_type: "success"});
					 if(msg.data){
						 $("#prpsCfgId").val(msg.data);
					 }
					//回调刷新列表
			        var callback = GET_W2Wcallback();
			        callback();
				 }else{
					 $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
				 }
			}
		});
	});

	//费用类型
	var feeTypCdListJSON = [];
    <c:if test="${not empty feeTypCdListJSON}"> feeTypCdListJSON = ${feeTypCdListJSON}; </c:if>
    //费用计算基数
	var calBaseCdListJSON = [];
    <c:if test="${not empty calBaseCdListJSON}"> calBaseCdListJSON = ${calBaseCdListJSON}; </c:if>
    //费用计入方式
	var cntWayCdListJSON = [];
    <c:if test="${not empty cntWayCdListJSON}"> cntWayCdListJSON = ${cntWayCdListJSON}; </c:if>
    //是否
	var yesOrNoCdListJSON = [];
    <c:if test="${not empty yesOrNoCdListJSON}"> yesOrNoCdListJSON = ${yesOrNoCdListJSON}; </c:if>
	feeGrid = $("#ligergrid_fee").ligerGrid({
        url: '<%=path%>/project/prjQuatPrpsCfgD/initList.do',
        method: 'get',
        columns: [
            {display: '费用类型', name: 'feeTypCd', minWidth: 80,
                editor: {
                    type: 'select',
                    data: feeTypCdListJSON,
                    valueField: 'code',
                    textField: 'codeNm'
                },
                valueField: 'feeTypCd',
                textField: 'feeTypCdNm',
                render: function (item) {
                    return item.feeTypCdNm;
                }
            },
            {display: '比例(下限%)', name: 'feePctMin', minWidth: 80,type: 'text',align: 'right',
	            editor: {type: 'number',
					precision:feeScale,
					toFix:true,
					onToFix:function(){
						 top.$.ligerDialog.SQalert({SQ_type: "warning",content: "小数点后面最多"+feeScale+"小数！"});
					}
				}
            },
            {display: '比例(上限%)', name: 'feePctMax', minWidth: 80, type: 'text',align: 'right',
            	editor: {type: 'number',
					precision:feeScale,
					toFix:true,
					onToFix:function(){
						 top.$.ligerDialog.SQalert({SQ_type: "warning",content: "小数点后面最多"+feeScale+"小数！"});
					}
				}
            },
            {display: '计算基数', name: 'calBaseCd', minWidth: 80,
            	editor: {
                    type: 'select',
                    data: calBaseCdListJSON,
                    valueField: 'key',
                    textField: 'value'
                },
                valueField: 'calBaseCd',
                textField: 'calBaseCdNm',
                render: function (item) {
                    return item.calBaseCdNm;
                }
            },
            {display: '是否固定金额', name: 'isFixedAmt', minWidth: 80,
            	editor: {
                    type: 'select',
                    data: yesOrNoCdListJSON,
                    valueField: 'key',
                    textField: 'value'
                },
                valueField: 'isFixedAmt',
                textField: 'isFixedAmtNm',
                render: function (item) {
                    return item.isFixedAmtNm;
                }
            },
            {display: '固定金额', name: 'fixedAmt', minWidth: 80, type: 'text',align: 'right',
            	editor: {type: 'number',precision:2,
                	toFix:true,
    				onToFix:function(){
    					 top.$.ligerDialog.SQalert({SQ_type: "warning",content: "小数点后面最多2位小数！"});
    				}
				}
            },
            {display: '计入方式', name: 'cntWayCd', minWidth: 80,
            	editor: {
                    type: 'select',
                    data: cntWayCdListJSON,
                    valueField: 'key',
                    textField: 'value'
                },
                valueField: 'cntWayCd',
                textField: 'cntWayCdNm',
                render: function (item) {
                    return item.cntWayCdNm;
                }
            },
            {display: '是否系统内置', name: 'isSysDef', minWidth: 80,
            	editor: {
                    type: 'select',
                    data: yesOrNoCdListJSON,
                    valueField: 'key',
                    textField: 'value'
                },
                valueField: 'isSysDef',
                textField: 'isSysDefNm',
                render: function (item) {
                    return item.isSysDefNm;
                }
            },
            {display: '是否允许变更', name: 'isAllowChg', minWidth: 80,
            	editor: {
                    type: 'select',
                    data: yesOrNoCdListJSON,
                    valueField: 'key',
                    textField: 'value'
                },
                valueField: 'isAllowChg',
                textField: 'isAllowChgNm',
                render: function (item) {
                    return item.isAllowChgNm;
                }
            },
            {display: '是否缺省显示', name: 'isDefVis', minWidth: 80,
            	editor: {
                    type: 'select',
                    data: yesOrNoCdListJSON,
                    valueField: 'key',
                    textField: 'value'
                },
                valueField: 'isDefVis',
                textField: 'isDefVisNm',
                render: function (item) {
                    return item.isDefVisNm;
                }
            }
        ],
        onBeforeSubmitEdit: function (e) {
        	/* e.record[e.column.textField] = e.text;
        	if(e.selected){
	        	e.record.isSysDef = e.selected.isSysDef;
	        	e.record.isSysDefNm = e.selected.isSysDefNm;
	        	e.record.isDefVis = e.selected.isSysDef;
	        	e.record.isDefVisNm = e.selected.isSysDefNm;
	        	e.record.isFixedAmt = e.selected.isFixedAmt;
	        	e.record.isFixedAmtNm = e.selected.isFixedAmtNm;
        	} */
        	//e.record.flag = e.selected.isSysDef;
        	if (e.column.columnname == "feePctMin" && e.record.isFixedAmt==1) {
            	e.value = "";
            }
            if (e.column.columnname == "feePctMax" && e.record.isFixedAmt==1) {
            	e.value = "";
            }
            if (e.column.columnname == "fixedAmt" && e.record.isFixedAmt==0) {
            	e.value = "";
            }
            //改变是否固定金额为否 - 清空金额项值
            if(e.column.columnname == "isFixedAmt" && e.value==0){
            	e.record.fixedAmt = "";
            }
            //改变是否固定金额为是 - 清空金额项值
            if(e.column.columnname == "isFixedAmt" && e.value==1){
            	e.record.feePctMin = "";
            	e.record.feePctMax = "";
            }
        },
        onBeforeEdit: function (e) {
            if (e.record.flag == 1){
            	if (e.column.columnname == "feeTypCd" || e.column.columnname == "isSysDef" || e.column.columnname == "isDefVis"){
            		e.column.editor.readonly = true;
            	}
            }else{
            	if (e.column.columnname == "feeTypCd" || e.column.columnname == "isSysDef" || e.column.columnname == "isDefVis"){
            		e.column.editor.readonly = false;
            	}
            }
            //是固定金额 比例不能填 
            if (e.column.columnname == "feePctMin" && e.record.isFixedAmt==1) {
            	e.column.editor.readonly=true;
            }else if(e.column.columnname == "feePctMin" && e.record.isFixedAmt==0){
            	e.column.editor.readonly=false;
            }
            if (e.column.columnname == "feePctMax" && e.record.isFixedAmt==1) {
            	e.column.editor.readonly=true;
            }else if(e.column.columnname == "feePctMax" && e.record.isFixedAmt==0){
            	e.column.editor.readonly=false;
            }
            //不是固定金额  金额不能填
            if (e.column.columnname == "fixedAmt" && e.record.isFixedAmt==0) {
            	e.column.editor.readonly=true;
            }else if(e.column.columnname == "fixedAmt" && e.record.isFixedAmt==1){
            	e.column.editor.readonly=false;
            }
        },
        usePager: false,
        root: 'rows',
        record: 'total',
        hideLoadButton: true,
        width: '100%',
        height: 300,
        heightDiff: -2,
        enabledEdit: true,
        isScroll: false,
        checkbox: true,
        rownumbers: true,
        allowUnSelectRow: true,
        alternatingRow: false
    });
	$("#addBtn").click(function (event) {
        feeGrid.addRow({
        	feeTypCd: '',
        	feePctMin: '',
        	feePctMax: '',
        	calBaseCd: '',
        	isFixedAmt:'',
        	fixedAmt:'',
        	cntWayCd: '',
        	isSysDef: '',
        	isAllowChg: '',
        	isDefVis: ''
        });
    });
	$("#delBtn").click(function (event) {
        var selectedRows = feeGrid.getSelectedRows();
        if(selectedRows.length == 0){
			$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_SELECT_MORE_ROW , SQ_type: "warning" });
			return;
		}
        for (var index in selectedRows) {
            if (selectedRows[index].flag == 1) {
                $.ligerDialog.SQalert({content: selectedRows[index].feeTypCdNm + "为必须费用，不能删除", SQ_type: "warning"});
                return;
            }
        }
        feeGrid.deleteSelectedRow();
    });
	initTab();
	initData();
	setIsSysDefDisabled();
});

//————————比例小数位————————
var feeScale = ProjectConstant.CODE_DEF_FEE_DECI_NUM;//费用比例
var annIntScale = ProjectConstant.CODE_DEF_FEE_DECI_NUM;//年利率
var floatScale = ProjectConstant.CODE_DEF_FEE_DECI_NUM;//上浮
var demicMap = '${demicMap}';
if(demicMap.length>0){
	demicMap = JSON.parse(demicMap);
	for(var key in demicMap) {
		if(key==ProjectConstant.CODE_ANNINT_RATE_NUM_CD){
			annIntScale = parseInt(demicMap[key]);
		}
		if(key==ProjectConstant.CODE_FLOAT_RATE_NUM_CD){
			floatScale = parseInt(demicMap[key]);
		}
		if(key==ProjectConstant.CODE_FEE_DECI_NUM_CD){
			feeScale = parseInt(demicMap[key]);
		}
	} 
}
//根据事业部获取比例小数位 
function getDemicMap(){
	var buOrgCd = $("#buOrgCd").val();
	if(buOrgCd && !StringUtils.isEmpty(buOrgCd)){
		$.ajax({
			type: 'get',
			dataType:'json',
			data:{
				buOrgCd:buOrgCd
			},
			url: '<%=path%>/project/prjQuatPrpsCfgM/getDemicMap.do',
			success:function(msg){
				var newDemicMap = msg;
				if(newDemicMap.length>0){
					newDemicMap = JSON.parse(newDemicMap);
					for(var key in newDemicMap) {
						if(key==ProjectConstant.CODE_ANNINT_RATE_NUM_CD){
							annIntScale = parseInt(newDemicMap[key]);
						}
						if(key==ProjectConstant.CODE_FLOAT_RATE_NUM_CD){
							floatScale = parseInt(newDemicMap[key]);
						}
						if(key==ProjectConstant.CODE_FEE_DECI_NUM_CD){
							feeScale = parseInt(newDemicMap[key]);
						}
					} 
				}
			}
		});
	}
}

		function initData(){
			var id = $("#prpsCfgId").val();
			if(!id){
				return;
			}
	    	var _url = '<%=path%>/project/prjQuatPrpsCfgM/getById.do';
	    	$.ajax({
	    		type: 'get',
	    		dataType:'json',
	    		data:{id:id},
	    		url: _url,
	    		success:function(msg){
	    			 if(msg.success == 1){
	    				 setData(msg.data);//设置数据
	    				 var _prpsCfgId = $("#prpsCfgId").val();
    				     if(_prpsCfgId){
    				    	feeGrid.setParm("prpsCfgId", _prpsCfgId);
    				    	feeGrid.reload();
    				     }
	    			 }else{
	    				 $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
	    			 }
	    		}
	    	});
    	}
		
		//设置页面数据
	    function setData(data){
			if(data.gpsRebBscPct){
				gpsRebBscPct = data.gpsRebBscPct;
			}
			if(data.gpsRebBscPc){
				gpsRebBscPc = data.gpsRebBscPc;
			}
			if(data.lsRebBscPct){
				lsRebBscPct = data.lsRebBscPct;
			}
	    	var form = liger.get("formSet1");
	    	form.setData({
	    		prpsTypCd:data.prpsTypCd,
	    		prpsCfgNo:data.prpsCfgNo,
	    		prpsPrdTypCd:data.prpsPrdTypCd,
	    		payWayCd:data.payWayCd,
	    		dpstHdlWayCd:data.dpstHdlWayCd,
	    		lsPdUntCd:data.lsPdUntCd,
	    		expHdlWayCd:data.expHdlWayCd,
	    		splRebPolicy:data.splRebPolicy,
	    		buOrgCd:data.buOrgCd,
	    		isAllowAdd:data.isAllowAdd.toString(),
	    		isSysDef:data.isSysDef.toString()
	    	});
	    	/* var isSysDef = data.isSysDef;//是否系统内置
	    	if(isSysDef && isSysDef=="1"){
	    		setPageDisabled();//设置页面所有标签禁用
	    		$("saveBtn1").hide(); //隐藏保存按钮
	    	} */
	    	var isAllowChg = data.isAllowChg;
	    	if(isAllowChg){
	    		var arr = isAllowChg.split(";");
	    		if(arr){
		    		if(arr[0] && arr[0]=="0"){
		    			liger.get("lsPdUntCd_flag").setValue(true);
		    		}
		    		if(arr[1] && arr[1]=="0"){
		    			liger.get("payWayCd_flag").setValue(true);
		    		}
		    		if(arr[2] && arr[2]=="0"){
		    			liger.get("dpstHdlWayCd_flag").setValue(true);
		    		}
		    		if(arr[3] && arr[3]=="0"){
		    			liger.get("expHdlWayCd_flag").setValue(true);
		    		}
		    		if(arr[4] && arr[4]=="0"){
		    			liger.get("ai_flag").setValue(true);
		    		}
	    		}
	    	}
	    	$("#prpsCfgNm").val(data.prpsCfgNm);
	    	$("#lsCoe").val(data.lsCoe);
	    	$("#lsPd").val(data.lsPd);
	    	
	    	//日期处理
	    	if(data.expStDt){
	    		var date = new Date(data.expStDt);
	    		var dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
	    		$("#expStDt").val(dateStr);
	    	}
	    	if(data.expEndDt){
	    		var date = new Date(data.expEndDt);
	    		var dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
	    		$("#expEndDt").val(dateStr);
	    	}
		};
		function setIsSysDefDisabled(){
			if(liger.get("isSysDef")){
				 form = liger.get("formSet1");
			    	form.setData({
			    		isSysDef:'0'
			    	});
				liger.get("isSysDef").setDisabled(true);				
			}
		}
		function setPageDisabled(){
			if(liger.get("prpsCfgNm")){
				liger.get("prpsCfgNm").setDisabled(true);				
			}
			if(liger.get("prpsTypCd")){
				liger.get("prpsTypCd").setDisabled(true);				
			}
			if(liger.get("buOrgCd")){
				liger.get("buOrgCd").setDisabled(true);				
			}
			if(liger.get("lsCoe")){
				liger.get("lsCoe").setDisabled(true);				
			}
			if(liger.get("expStDt")){
				liger.get("expStDt").setDisabled(true);				
			}
			if(liger.get("expEndDt")){
				liger.get("expEndDt").setDisabled(true);				
			}
			if(liger.get("isAllowAdd")){
				liger.get("isAllowAdd").setDisabled(true);				
			}
			if(liger.get("payWayCd")){
				liger.get("payWayCd").setDisabled(true);				
			}
			if(liger.get("payWayCd_flag")){
				liger.get("payWayCd_flag").setDisabled(true);				
			}
			if(liger.get("dpstHdlWayCd")){
				liger.get("dpstHdlWayCd").setDisabled(true);				
			}
			if(liger.get("dpstHdlWayCd_flag")){
				liger.get("dpstHdlWayCd_flag").setDisabled(true);				
			}
			if(liger.get("lsPdUntCd")){
				liger.get("lsPdUntCd").setDisabled(true);				
			}
			if(liger.get("lsPdUntCd_flag")){
				liger.get("lsPdUntCd_flag").setDisabled(true);				
			}
			if(liger.get("expHdlWayCd_flag")){
				liger.get("expHdlWayCd_flag").setDisabled(true);				
			}
			if(liger.get("ai_flag")){
				liger.get("ai_flag").setDisabled(true);				
			}
			if(liger.get("lsPd")){
				liger.get("lsPd").setDisabled(true);				
			}
			if(liger.get("expHdlWayCd")){
				liger.get("expHdlWayCd").setDisabled(true);				
			}
			if(liger.get("splRebPolicy")){
				liger.get("splRebPolicy").setDisabled(true);				
			}
		}

		//初始化Tab页
	    function initTab(){
	    	pageInTab = $("#pageInTab").ligerTab({
	            height: 'auto',
	            contextmenu: false,
	            minIframeHeight: GET_minIframeHeight(),
	            onBeforeSelectTabItem: function (tabid) {
	            	var _prpsCfgId = $("#prpsCfgId").val();
	            	if(tabid!="tabA"){
		                if(!_prpsCfgId){
		                	top.$.ligerDialog.SQalert({content: "请确认报价方案基本信息已存在", SQ_type: "warning"});
		                	return false;
		                }
	            	}
	            },
	            onAfterSelectTabItem: function(tabid) {
	                if (loadedTabs.indexOf(tabid)<0) {
	                	var _prpsCfgId = $("#prpsCfgId").val();
	                	if(tabid!="tabA"){
		                	if(!_prpsCfgId){
		                		 top.$.ligerDialog.SQalert({content: "请确认报价方案基本信息已存在", SQ_type: "warning"});
		                         return false; 
		                	}
	                	}
	                    loadedTabs.push(tabid);
	                    switch (tabid){
	                        case "tabB":
	                            pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjQuatPrpsAttr/toAddPage.do?prpsCfgId="+_prpsCfgId);
	                            break;
	                        case "tabC":
	                            pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjQuatPrpsCfgAi/toListPage.do?prpsCfgId="+_prpsCfgId+"&annIntScale="+annIntScale);
	                            break;
	                        case "tabD":
	                            pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjQuatPrpsReb/toListPage.do?prpsCfgId="+_prpsCfgId+"&gpsRebBscPct="+gpsRebBscPct+"&gpsRebBscPc="+gpsRebBscPc+"&lsRebBscPct="+lsRebBscPct);
	                            break;
	                        case "tabE":
	                            pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjQuatPrpsReb/toListPage2.do?prpsCfgId="+_prpsCfgId);
	                            break;
	                    }
	                };
	                SetIframe_height();
	            }
	        });

	        /* $.extend(true, pageInApp, {
	            pageInTab: pageInTab
	        }); */
	    };
</script>



</body>
</html>
